x86: fix guest CPUID handling
authorJan Beulich <jbeulich@suse.com>
Fri, 2 May 2014 10:09:03 +0000 (12:09 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 2 May 2014 10:09:03 +0000 (12:09 +0200)
commit4c0ff6bd54b5a67f8f820f9ed0a89a79f1a26a1c
treecaf0335509207f49673967d3fd596ffcd2290d0f
parent3196856c65a1e324e86767ad8d79432d8fc8da87
x86: fix guest CPUID handling

The way XEN_DOMCTL_set_cpuid got handled so far allowed for surprises
to the caller. With this set of operations
- set leaf A (using array index 0)
- set leaf B (using array index 1)
- clear leaf A (clearing array index 0)
- set leaf B (using array index 0)
- clear leaf B (clearing array index 0)
the entry for leaf B at array index 1 would still be in place, while
the caller would expect it to be cleared.

While looking at the use sites of d->arch.cpuid[] I also noticed that
the allocation of the array needlessly uses the zeroing form - the
relevant fields of the array elements get set in a loop immediately
following the allocation.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/domain.c
xen/arch/x86/domctl.c